<script setup lang="ts">
import { ConsultType } from '@/enum'
import { ref } from 'vue'
import RecordList from './components/RecordList.vue'

// tab页的分组数据
const tabList = [
  {
    title: '极速问诊',
    type: ConsultType.fast
  },
  {
    title: '找医生',
    type: ConsultType.doctor
  },
  {
    title: '开药问诊',
    type: ConsultType.medicine
  }
]
const activeName = ref('fast')
// 点击tab页
const onClickTab = ({ title }: { title: string }) => {
  activeName.value = title
}
</script>

<template>
  <div class="consult-record-page">
    <DP-NavBar
      title="问诊记录"
      :back="
        () => {
          $router.push({ name: 'user' })
        }
      "
    ></DP-NavBar>
    <van-tabs v-model:active="activeName" @click-tab="onClickTab" sticky>
      <van-tab
        v-for="item in tabList"
        :key="item.type"
        :title="item.title"
        :name="item.title"
      >
        <record-list :type="item.type"></record-list>
      </van-tab>
    </van-tabs>
  </div>
</template>

<style lang="scss" scoped>
.consult-record-page {
  margin-top: 46px;
  min-height: 93.1vh;
  background-color: #f5f6f8;
}
</style>
